/**
 *
 */
package demo.tellurium.module.gbms


import org.apache.commons.lang.math.RandomUtils;
import org.telluriumsource.ui.object.RadioButton;

import groovy.lang.MetaClass;
import demo.tellurium.framework.BaseUIModule;
import demo.tellurium.framework.BaseUIModule.OfferingTypeOptionIndex 

/**
 * @author roger.xu
 *
 */
public class GBMSRunReportsModule extends BaseUIModule {

    private static final String MODULE_NAME = "GBMSRunReports";
    public static final String PATH_KEY = "gbms.run_reports.path";

    @Override
    public String getModuleName() {
        return MODULE_NAME;
    }

    @Override
    public void defineUi() {
        ui.Container(uid: "GBMSRunReports") {
            // RunReportsType
            DOJO_ComboBox(uid: "RunReportsType", widgetid: "com_ibm_sherpa_Select_0")
            // Report
            DOJO_ComboBox(uid: "Report", widgetid: "dijit_form_ComboBox_0")
            // Division
            DOJO_ComboBox(uid: "Division", widgetid: "Division")
            // Type
            DOJO_ComboBox(uid: "Type", widgetid: "Type")
            // IPD phase  
            DOJO_ComboBox(uid: "IPD", widgetid: "IPD phase  ")
            // State
            DOJO_ComboBox(uid: "State", widgetid: "State")
             // Translation classification
            DOJO_ComboBox(uid: "Translation", widgetid: "Translation classification")
            Button(uid: "RunReportButton", clocator: [tag: "input", type: "button", id: "runReportButton"])
            Button(uid: "SaveReportButton", clocator: [tag: "input", type: "button", id: "saveReportButton"])
        }
    }

    /* ---- Button ---------------*/
    public void doClickButton(String buttonName) {
        String widgetUid = String.format("%s.%s", getModuleName(), buttonName);
        click widgetUid
        pause 3000
    }

    /* ---- ComboBox ---------------*/
    public void doSelectComboBox(String widgetName, int index) {
        console.debug("[ComboBox]", widgetName);
        def widgetUid = String.format("%s.%s", getModuleName(), widgetName);
        doSelectComboBoxItem(widgetUid, index);
    }

    /* ---- Input TextBox ---------------*/
    public void doInputTextBox(String widgetName, String input) {
        console.debug("[TextBox]", widgetName);
        def widgetUid = String.format("%s.%s", getModuleName(), widgetName);

        doInputTextBox(widgetUid, input);
    }
}
